1. Field of the Invention
The present invention relates generally to data networks and, more particularly, to multi-protocol label switching in a network device.
2. Description of Related Art
Multi-protocol label switching (MPLS) is a forwarding scheme in which packet forwarding is based on one or more MPLS labels included in the packet. For example, FIG. 1 illustrates an exemplary data packet 100 transmitted in accordance with MPLS. Data packet 100 includes header 110, MPLS label 120 and payload 130.
Header 110 may include source and destination information for data packet 100, such as a data link layer header. MPLS label 120, also referred to hereafter as a tag, is a 4-byte field that includes a 20-bit label 122, a 3-bit class of service (CoS) identifier 124, a bottom of stack (S) bit 126, and an 8-bit time-to-live (TTL) field 128. Label 122 includes information for identifying the next hop for data packet 100. CoS identifier 124 indicates the class of service with which the packet should be handled. Bottom of stack bit 126 may indicate whether MPLS label 120 is the bottom label in a stack of labels. For example, a packet may include a number of labels similar to MPLS label 120. Typically, when multiple MPLS labels are present, the MPLS labels 120 are organized as a last-in, first-out stack referred to as a label stack. Bottom of stack bit 126 identifies whether MPLS label 120 is the bottom label in the label stack. TTL field 128 may include a count value that identifies the number of hops/links over which a packet may be routed and may be used to prevent a packet from staying in a network indefinitely. TTL field 128 may be decremented at each hop that data packet 100 takes. When the count value in a packet's TTL field 128 reaches zero or some other predetermined value, the data packet may be discarded. Payload 130 may include the actual payload of data packet 100, such as a conventional Internet Protocol (IP) packet. For example, payload 130 may include an IPv4 or an IPv6 packet.
In conventional network routing, a router uses the information in payload 130 to determine the next hop(s) for data packet 100. In MPLS routing, a router uses the information in MPLS label 120 to determine how to route packet 100 to its intended destination(s).
During processing of packet 100, the router may “pop” one or more of the tags (i.e., remove one or more of the tags from the packet). For example, if a label stack is present, the router may pop one or more tags from the top of the label stack. The router may also “push” tags onto the packet (i.e., add one or more tags to the packet). For example, if a label stack is present, the router may add one or more tags to the top of the label stack. When tags are popped, TTL field 128 is typically copied to the next tag in the stack. Similarly, when tags are pushed, TTL field 128 is typically copied from the top tag in the stack to the new tag.
A problem associated with processing MPLS packets occurs in the popping and pushing of tags. For example, in some routers, when a data packet is received, the data packet is written to a memory. In this situation, copying a TTL field from a popped tag to the next tag in the stack may require accessing the memory where the data packet is stored. For example, the router may read the packet from memory, delete the popped tag, copy the TTL from the popped tag to the next tag in the stack and restore the modified packet in memory. Accessing the memory in this manner increases internal router bandwidth requirements associated with reading/writing data to/from the memory. Such bandwidth requirements are typically costly and may increase latency associated with forwarding MPLS packets.
Therefore, there exists a need for systems and methods that improve the processing associated with MPLS packets.